import {Component} from 'react';
import WithRoute from '../router/withRoute';
//  import {useSearchParams} from 'react-router-dom'
// function Info(){
//     // searchParams 用来获取路径参数 setSearch 用来更改路径参数
//     let [searchParams,setSearch] = useSearchParams();
//     console.log(searchParams)
//     // 获取对应路径参数的属性值
//     let id = searchParams.get("id");
//     console.log(id)
//     let price = searchParams.get("price")
//     return (
//         <div>
//             <h1>详情页---{id}----{price}</h1>
//             <button onClick={()=>{
//                 // 更改路径参数
//                 setSearch('id=110&price=120')
//             }}>设置search参数</button>
//         </div>
//     )
// }
class Info extends Component{
    render(){
        console.log(this.props)
        let [searchParams,setSearch] = this.props.router.search;
        let id = searchParams.get("id");
        let price = searchParams.get("price");
        return (
            <div>
                <h1>详情页--{id}---{price}</h1>
                <button onClick={()=>{
                    setSearch("id=110&price=100")
                }}>改变search</button>
            </div>
        )
    }
}
export default WithRoute(Info)